<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Title</title>
	<link rel="stylesheet" href="/static/dependency/js/bootstrap-3.3.7/css/bootstrap.css">
	<link rel="stylesheet" href="/static/dependency/js/messenger/build/css/messenger-theme-future.css">
	<link rel="stylesheet" href="/static/dependency/js/messenger/build/css/messenger.css">
	<link rel="stylesheet" href="/static/dependency/js/simplePagination.js/simplePagination.css">
	<link rel="shortcut icon" type="image/x-icon" href="/static/dependency/pic/logo.ico"/>
	<script src="/static/dependency/js/jquery-3.2.1.min.js"></script>
	<script src="/static/dependency/js/bootstrap-3.3.7/js/bootstrap.js"></script>
	<script src="/static/dependency/js/messenger/build/js/messenger.js"></script>
	<script src="/static/dependency/js/simplePagination.js/jquery.simplePagination.js"></script>
</head>
<body>
<input type="text" id="name">
<button type="button" id="btn">按这里</button>
<h1 id="h1">原始文本</h1>
<script>
	jQuery(document).ready(function () {
		jQuery("#btn").click(function () {
            var name = document.getElementById('name').value;
            jQuery.ajax({
                type: 'POST', url: '/test',
                data: JSON.stringify({"name": name}),
                contentType: 'application/json; charset=UTF-8',
                dataType: 'json',
                success: function (response) {
                    console.log(response.text)
                    jQuery("#h1").text(response.text)
	                window.location.href='http://www.jb51.net';
                }
            })
        })
    })
</script>

</body>
</html>